#!/bin/bash

function jeden() {
  echo
  echo "Compiling: $1"
  echo
  fpc $1.dpr -FE../.. -Sd -Fo../obj -FU../obj -Fu../ -gl \
    -Fi../Imaging -Fu../Imaging -Fu../Imaging/Extensions -Fu../Imaging/Extras/Extensions -Fu../Imaging/JpegLib -Fu../Imaging/ZLib -Fl../Imaging/Extras/Extensions/J2KObjects \
    -Fu../Soar -Fu../common -Fu../common/lnet/lib \
    -Fu/usr/lib/fpc/2.0.4/units/i386-linux/opengl \
    -Fu/usr/lib/fpc/2.0.4/units/i386-linux/x11 \
    -Fu/usr/lib/fpc/2.0.4/units/i386-linux/netdb \
    -Fu/usr/lib/fpc/2.0.4/source/fpcsrc/fcl/inc
  if [ "$?" != "0" ]; then
    echo "ERROR! Press enter to continue"
    read ANS
    exit 1
  fi
  if [ "$2" = "run" ]; then
    cd ../..
    ./$1 || read
    cd src/test
  fi
}

clear
#jeden test_01_human
jeden test_02_soar
#jeden test_03_keys
#jeden test_04_lights
#jeden test_05_skybox
#jeden test_06_tree run
#jeden test_07_track run
read